package com.kaiwukj.android.ufamily.provides;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.Utils;
import com.kaiwukj.android.ufamily.BuildConfig;
import com.kaiwukj.android.ufamily.app.constant.Constant;

import java.util.concurrent.TimeUnit;

import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;

/**
 * Created by Administrator on 2019/10/26
 */
public class InitProvide extends ContentProvider {

    Disposable disposable;

    @Override
    public boolean onCreate() {

        if (getContext() != null) {
            disposable = Observable.timer(800, TimeUnit.MILLISECONDS)
                    .subscribe(aLong -> {
                        init(getContext().getApplicationContext());
                        if (disposable != null && !disposable.isDisposed()) {
                            disposable.dispose();
                        }
                    });
        }

        return false;
    }

    @Nullable
    @Override
    public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
        return null;
    }

    @Nullable
    @Override
    public String getType(@NonNull Uri uri) {
        return null;
    }

    @Nullable
    @Override
    public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
        return null;
    }

    @Override
    public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
        return 0;
    }

    @Override
    public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
        return 0;
    }

    private void init(Context application) {

        //MobSDK.init(application,"1115190326030529#communityhui");


        // LeakCanary.install((Application) application);
    }
}
